package org.destinyshine.cricket.utils;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.WritableByteChannel;

/**
 * Created by destinyliu on 2016/4/10.
 */
public abstract class ChannelUtils {

    public static void write(WritableByteChannel channel, ByteBuffer... buffers) throws IOException {
        for (ByteBuffer buffer : buffers) {
            while (buffer.hasRemaining()) {
                channel.write(buffer);
            }
        }
    }
}
